package com.turing.post.cardmanagement.util;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;

/**
 * 销售机构出入库明细表
 * 
 * @author ys
 * @date 2012-12-17
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "SaleCardStockDetail")
@IdClass(SaleCardStockDetail.class)
public class SaleCardStockDetail implements Serializable {

	public SaleCardStockDetail() {
		super();
	}

	/**
	 * 出入库单ID
	 */
	private BigInteger IoOrderId;
	/**
	 * 销售机构
	 */
	private String SaleBranchNo;
	/**
	 * 交易日期
	 */
	private Date TranDate;
	/**
	 * 交易时间
	 */
	private Date Trantime;
	/**
	 * 交易类型
	 */
	private String TranType;
	// /**
	// * 卡片种类ID
	// */
	// private BigInteger CardClassicId;
	// /**
	// * 卡片面值ID
	// */
	// private BigInteger CardParValueId;

	/**
	 * 卡面图样
	 */
	private BigInteger cardFaceId;
	/**
	 * 制卡批次号
	 */
	private String BatchNo;
	/**
	 * 起始序号
	 */
	private String CardStartSeqNo;
	/**
	 * 终止序号
	 */
	private String CardEndSeqNo;
	/**
	 * 发生张数
	 */
	private Integer OrderCount;
	/**
	 * 操作员ID
	 */
	private BigInteger OperId;
	/**
	 * 备注
	 */
	private String Remark;

	/**
	 * 制卡入库
	 */
	public final static String ISSUECARDSTOCKDETAIL_TRANTYPE_MAKE = "0";

	/**
	 * 调拨入库
	 */
	public final static String ISSUECARDSTOCKDETAIL_TRANTYPE_TRAN_IN = "1";

	/**
	 * 调拨出库
	 */
	public final static String ISSUECARDSTOCKDETAIL_TRANTYPE_TRAN_OUT = "2";

	/**
	 * 盘盈入库
	 */
	public final static String ISSUECARDSTOCKDETAIL_TRANTYPE_INVENTORY_PROFIT = "3";

	/**
	 * 销售出库
	 */
	public final static String SALECARD_TRANTYPE_STOCKOUT = "4";
	/**
	 * 补发、换发出库
	 */
	public final static String SALECARD_TRANTYPE_REISSUEOUT = "5";

	/**
	 * 丢失损坏
	 */
	public final static String ISSUECARDSTOCKDETAIL_TRANTYPE_LOSE = "9";

	@Id
	@Column(name = "IOORDERID", nullable = false)
	public BigInteger getIoOrderId() {
		return IoOrderId;
	}

	public void setIoOrderId(BigInteger ioOrderId) {
		IoOrderId = ioOrderId;
	}

	@Id
	@Column(name = "SALEBRANCHNO", nullable = false)
	public String getSaleBranchNo() {
		return SaleBranchNo;
	}

	public void setSaleBranchNo(String issueBranchNo) {
		SaleBranchNo = issueBranchNo;
	}

	@Column(name = "TRANDATE", nullable = false)
	public Date getTranDate() {
		return TranDate;
	}

	public void setTranDate(Date tranDate) {
		TranDate = tranDate;
	}

	@Id
	@Column(name = "TRANTIME", nullable = false)
	public Date getTrantime() {
		return Trantime;
	}

	public void setTrantime(Date trantime) {
		Trantime = trantime;
	}

	@Column(name = "TRANTYPE", nullable = false)
	public String getTranType() {
		return TranType;
	}

	public void setTranType(String tranType) {
		TranType = tranType;
	}

	// @Column(name = "CARDCLASSICID", nullable = false)
	// public BigInteger getCardClassicId() {
	// return CardClassicId;
	// }
	//
	// public void setCardClassicId(BigInteger cardClassicId) {
	// CardClassicId = cardClassicId;
	// }
	//
	// @Column(name = "CARDPARVALUEID", nullable = false)
	// public BigInteger getCardParValueId() {
	// return CardParValueId;
	// }
	//
	// public void setCardParValueId(BigInteger cardParValueId) {
	// CardParValueId = cardParValueId;
	// }

	@Column(name = "cardFaceId")
	public BigInteger getCardFaceId() {
		return cardFaceId;
	}

	public void setCardFaceId(BigInteger cardFaceId) {
		this.cardFaceId = cardFaceId;
	}

	@Column(name = "BATCHNO", nullable = false)
	public String getBatchNo() {
		return BatchNo;
	}

	public void setBatchNo(String batchNo) {
		BatchNo = batchNo;
	}

	@Id
	@Column(name = "CARDSTARTSEQNO", nullable = false)
	public String getCardStartSeqNo() {
		return CardStartSeqNo;
	}

	public void setCardStartSeqNo(String cardStartSeqNo) {
		CardStartSeqNo = cardStartSeqNo;
	}

	@Column(name = "CARDENDSEQNO", nullable = false)
	public String getCardEndSeqNo() {
		return CardEndSeqNo;
	}

	public void setCardEndSeqNo(String cardEndSeqNo) {
		CardEndSeqNo = cardEndSeqNo;
	}

	@Column(name = "ORDERCOUNT", nullable = false)
	public Integer getOrderCount() {
		return OrderCount;
	}

	public void setOrderCount(Integer orderCount) {
		OrderCount = orderCount;
	}

	@Column(name = "OPERID", nullable = false)
	public BigInteger getOperId() {
		return OperId;
	}

	public void setOperId(BigInteger operId) {
		OperId = operId;
	}

	@Column(name = "REMARK", nullable = false)
	public String getRemark() {
		return Remark;
	}

	public void setRemark(String remark) {
		Remark = remark;
	}

	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime
				* result
				+ ((getCardStartSeqNo() == null) ? 0 : getCardStartSeqNo()
						.hashCode());
		result = prime * result
				+ ((getIoOrderId() == null) ? 0 : getIoOrderId().hashCode());
		result = prime
				* result
				+ ((getSaleBranchNo() == null) ? 0 : getSaleBranchNo()
						.hashCode());
		result = prime * result
				+ ((getTrantime() == null) ? 0 : getTrantime().hashCode());
		return result;
	}

	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		SaleCardStockDetail other = (SaleCardStockDetail) obj;
		if (getCardStartSeqNo() == null) {
			if (other.getCardStartSeqNo() != null)
				return false;
		} else if (!getCardStartSeqNo().equals(other.getCardStartSeqNo()))
			return false;
		if (getIoOrderId() == null) {
			if (other.getIoOrderId() != null)
				return false;
		} else if (!getIoOrderId().equals(other.getIoOrderId()))
			return false;
		if (getSaleBranchNo() == null) {
			if (other.getSaleBranchNo() != null)
				return false;
		} else if (!getSaleBranchNo().equals(other.getSaleBranchNo()))
			return false;
		if (getTrantime() == null) {
			if (other.getTrantime() != null)
				return false;
		} else if (!getTrantime().equals(other.getTrantime()))
			return false;
		return true;
	}
}
